package com.xmb.common.controller.internal;

import com.xmb.common.entity.XmbOrderRewardSetting;
import com.xmb.common.service.OrderRewardSettingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created by lyndon on 2019/4/10.
 */
@RestController
@RequestMapping(value = "/order/reward")
public class OrderRewardController {

    @Autowired
    private OrderRewardSettingService orderRewardSettingService;

    /**
     * 增加分销配置信息
     * @param
     */
    @PostMapping(value = "saveXmbOrderRewardSetting")
    public int saveXmbOrderRewardSetting(@RequestBody XmbOrderRewardSetting orderRewardSetting){
        return orderRewardSettingService.saveXmbOrderRewardSetting(orderRewardSetting);
    }

    /**
     * 修改分销配置信息
     * @param
     */
    @PostMapping(value = "updateXmbOrderRewardSetting")
    public int updateXmbOrderRewardSetting(@RequestBody XmbOrderRewardSetting orderRewardSetting){
        return orderRewardSettingService.updateXmbOrderRewardSetting(orderRewardSetting);
    }

    /**
     * 获取分销配置信息
     * @param
     */
    @GetMapping(value = "findXmbOrderRewardSetting/{senceId}/{senceType}")
    public XmbOrderRewardSetting findXmbOrderRewardSetting(@PathVariable("senceId")Long senceId,@PathVariable("senceType")String senceType){
        return orderRewardSettingService.findXmbOrderRewardSetting(senceId,senceType);
    }

    /**
     * 删除分销配置信息
     * @param
     */
    @PutMapping(value = "deleteXmbOrderRewardSetting/{id}")
    public int deleteXmbOrderRewardSetting(@PathVariable("id")Long id){
        return orderRewardSettingService.deleteXmbOrderRewardSetting(id);
    }

}
